﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace BabyLearnEnglish_srcum_demo
{
    public partial class frmXemDiem : Form
    {
        public static int curPos = 0;

        public frmXemDiem()
        {
            InitializeComponent();
        }

        private void btnDong_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void frmXemDiem_Load(object sender, EventArgs e)
        {
            int orderNumber = -1;
            if (Form1.isFinished)
            {
                HighScore h = new HighScore();
                h.Name = Form1.uername;
                h.Score = Form1.score;

                orderNumber = h.orderAndSaveList(h);
            }
            List<HighScore> list = new List<HighScore>();
            list = new HighScore().getList();

            for (int i = 0; i < list.Count; i++)
            {
                dgvHighScore.Rows.Add(i + 1, list[i].Name, list[i].Score);        
            }
            if (Form1.isFinished)
            {
                dgvHighScore.Rows[orderNumber].DefaultCellStyle.BackColor = Color.LightGreen;
            }
            setUI();
        }

        public void setUI()
        {
            if (Form1.Lang == "Vi")
            {
                this.Text = "Cửa sổ bảng xếp hạng";
                clDiem.HeaderText = "Điểm số";
                clSTT.HeaderText = "STT";
                clTen.HeaderText = "Tên";
                btnDong.Text = "Đóng";
            }
            else
            {
                this.Text = "High score window";
                clDiem.HeaderText = "Score";
                clSTT.HeaderText = "Order";
                clTen.HeaderText = "Name";
                btnDong.Text = "Close";
            }
        }
    }
}
